#ifndef IMAGEMEDIA_H
#define IMAGEMEDIA_H

#include <unistd.h>
#include "LogUtils.h""
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavcodec/jni.h"
#include "libavfilter/avfilter.h"
#include "libavutil/imgutils.h"
#include "libswscale/swscale.h"
#include "libavfilter/buffersrc.h"
#include "libavfilter/buffersink.h"
#include "libswresample/swresample.h"
#include "libavutil/opt.h"
#include "libavformat/avio.h"
#include "libavutil/timestamp.h"
#include "libavutil/avassert.h"
}

class ImageMedia
{

public:
    ImageMedia();
    ~ImageMedia();
    /**
     * 解码图片
     * @return
     */
    AVFrame* decode(const char *file_path);
    AVFrame* decode(const uint8_t *img_data);

private:
    /**
     * AVFrame 转 为YUVi420
     * @param imgFrame
     * @return
     */
    AVFrame* convertImgYUV(const AVCodecContext *codec_ctx,AVFrame *imgFrame);


};

#endif // IMAGEMEDIA_H
